
<?php
include("health_promo_class.php");

	if(isset($_REQUEST['id'])){
	$vid =$_REQUEST['id'];
}

//$vid =$_REQUEST["id"];
$obj=new health_promo_class();
	if(!$obj->get_promo($vid)){
	echo "error";
	echo mysql_error();
	exit();
	}
	$row = $obj->fetch();

    $id_health=$row["idhealth_promotion"];
	$date=$row["date"];
	$venue=$row["venue"];
	$topic=$row["topic"];
	$method=$row["method"];
	$target_audience=$row["target_audience"];
	$number_of_audience=$row["number_of_audience"];
	$remarks=$row["remarks"];
	$month=$row["month"];
	$latitude=$row["latitude"];
	$longitude=$row["longitude"];
	$image=$row["image"];
	$idcho=$row["idcho"];
	$subdistrict_id=$row["subdistrict_id"];
	
	/*if(isset($_REQUEST['id'])){
	$vid =$_REQUEST['id'];
	
    $id_health=$row["idhealth_promotion"];
	$date=$row["date"];
	$venue=$row["venue"];
	$topic=$row["topic"];
	$method=$row["method"];
	$target_audience=$row["target_audience"];
	$number_of_audience=$row["number_of_audience"];
	$remarks=$row["remarks"];
	$month=$row["month"];
	$latitude=$row["latitude"];
	$longitude=$row["longitude"];
	$image=$row["image"];
	$idcho=$row["idcho"];
	$subdistrict_id=$row["subdistrict_id"];
	
	}*/
	
	?>
	
	<?php
	$dat="";
	if (isset($_REQUEST["date"])) {
		$dat=$_REQUEST["date"];
	}
	$venu="";
	if (isset($_REQUEST["venue"])) {
		$venu=$_REQUEST["venue"];
	}
	$topi="";
	if (isset($_REQUEST["topic"])) {
		$topi=$_REQUEST["topic"];
	}
	$metho="";
	if (isset($_REQUEST["method"])) {
		$metho=$_REQUEST["method"];
	}
	$target_audienc="";
	if (isset($_REQUEST["target_audience"])) {
		$target_audienc=$_REQUEST["target_audience"];
	}
	$number_of_audienc="";
	if (isset($_REQUEST["number_of_audience"])) {
		$number_of_audienc=$_REQUEST["number_of_audience"];
	}
	$remark="";
	if (isset($_REQUEST["remarks"])) {
		$remark=$_REQUEST["remarks"];
	}
	$mon="";
	if (isset($_REQUEST["month"])) {
		$mon=$_REQUEST["month"];
	}
	$lat="";
	if (isset($_REQUEST["latitude"])) {
		$lat=$_REQUEST["latitude"];
	}
	$long="";
	if (isset($_REQUEST["longitude"])) {
		$long=$_REQUEST["longitude"];
	}
	$imag="";
	if (isset($_REQUEST["image"])) {
		$imag=$_REQUEST["image"];
	}
	$idch="";
	if (isset($_REQUEST["idcho"])) {
		$idch=$_REQUEST["idcho"];
	}
	$subdis_id="";
	if (isset($_REQUEST["subdistrict_id"])) {
		$subdis_id=$_REQUEST["subdistrict_id"];
	}
	
	if(!$obj->update_health_promo($vid,$dat,$venu,$topi,$metho,$target_audienc,$number_of_audienc,$remark,$mon,$lat,$long,$imag,$idch,$subdis_id)){
	echo "cannot update";
	echo mysql_error();
		}
	
//---------------------------------

	?>
	
	
<html>
	<link rel="stylesheet" href="style.css"/>
	<body class="pageBody">
		<!--<h2> Health Promotion Edit Page </h2>-->
		<form action = "health_promotion_home.php" method = "GET">
			<input type="submit" value="Back to Home" name="hphome"/>
		</form>
			<form name="input" action ="health_promo_edit.php" method="get">
				<table class="listTable" width='50%' align='center'>
					<tr class="lheader">
						<td colspan="2" id="pageheader">
							Health Promotion Edit Page
						</td>
					</tr>
	 						
								<div><tr>
									<td class="label">ID: </td>
									<td class="field"><input type="text" name="date" value="<?php echo $id_health  ?>"></td>
								</tr></div>
								<tr>
									<td class="label">Date: </td>
									<td class="field"><input type="date" name="date" value="<?php echo $date  ?>>"</td>
								</tr>
								<tr>
									<td class="label">Venue: </td>
									<td class="field"><input type="text" name="venue" value="<?php echo $venue  ?>"></td>
								</tr
								<tr>
									<td class="label">Topic: </td>
									<td class="field"><input type="text" name="topic" value="<?php echo $topic ?>"></td>
								</tr>
								<tr>
									<td class="label">Method: </td>
									<td class="field"><input type="text" name="method" value="<?php echo $method ?>"></td>
								</tr>
								<tr>
									<td class="label">Target Audience: </td>
									<td class="field"><input type="text" name="target_audience" value="<?php echo $target_audience ?>"/></td>
								</tr>
								<tr>
									<td class="label">Number of Audience: </td>
									<td class="field"><input type="text" name="number_of_audience" value="<?php echo $number_of_audience?>"/></td>
								</tr
								
								<tr>
									<td class="label">Remarks: </td>
									<td class="field"><input type="text" name="remarks" value="<?php echo $remarks ?>"/></td>
								</tr>
								<tr>
									<td class="label">Month: </td>
									<td class="field"><input type="month" name="month" value="<?php echo $month ?>"></td>
								</tr>
								<tr>
									<td class="label">Latitude: </td>
									<td class="field"><input type="text" name="latitude" value="<?php echo $latitude ?>"/></td>
								</tr>
								<tr>
									<td class="label">Longitude: </td>
									<td class="field"><input type="text" name="longitude" value="<?php echo $longitude ?>"></td>
								</tr
								<tr>
									<td class="label">Image: </td>
									<td class="field"><input type="text" name="image" value="<?php echo $image ?>"></td>
								</tr>
								<tr>
									<td class="label">IDcho: </td>
									<td class="field"><input type="text" name="id_cho" value="<?php echo $idcho ?>"></td>
								</tr>
								<tr>
									<td class="label">Subdistrict ID: </td>
									<td class="field"><input type="text" name="subdistrict_id" value="<?php echo $subdistrict_id?>"></td>
								</tr>
								
								<tr>
									<td class="label" ></td>
									<td class="field"><input type="hidden" name="id" value="<?php echo $vid ?>"></td>
								</tr>
								<tr>
									<td class="label"></td>
									<td class="field">
										<input type="submit" value="Save" name="submit_button" >
								</tr>
		
							</form>	
							
							
						</table>
					
<!--		idhealth_promotion:<input type="text" name="date" value="<?php echo $id_health ?>">
 Date:<input type="text" name="date" value="<?php echo $date  ?>">
 Venue:<input type="text" name="venue" value="<?php echo $venue ?>">
 Topic:<input type="text" name="topic" value="<?php echo $topic ?>">
 Method:<input type="text" name="method" value="<?php echo $method ?>">
 Target_audience:<input type="text" name="target_audience" value="<?php echo $target_audience ?>">
 Number of audience:<input type="text" name="number of audience" value="<?php echo $number_of_audience?>">
 Remarks:<input type="text" name="remarks" value="<?php echo $remarks ?>">
 Month :<input type="text" name="month" value="<?php echo $month ?>">
 Longitude:<input type="text" name="longitude" value="<?php echo $longitude ?>">
 Latitude:<input type="text" name="latitude" value="<?php echo $latitude ?>">
 Image:<input type="text" name="image" value="<?php echo $image ?>">
 Idcho:<input type="text" name="idcho" value="<?php echo $idcho ?>">
 Subdistrict_id :<input type="text" name="subdistrict_id" value="<?php echo $subdistrict_id?>">
<input type="hidden" value="<?php echo $vid ?>" name="id">
<input type="submit" value="save">

</form>-->
<!--
<?php 
$obj->get_promo($vid);
$row = $obj->fetch();
 print_r( $row)?>-->